package com.bos.database;

import com.alibaba.druid.pool.DruidDataSource;
import com.bos.utils.Base64Utils;
/**
 * @author misterWei
 * @create 2019年01月26号:19点05分
 * @mailbox mynameisweiyan@gmail.com
 * 这是一个对数据库密码加密的逻辑
 */
public class OracleDataSource extends DruidDataSource {
    @Override
    public void setUsername(String username) {
        String newUserName = null ;
      try {
           newUserName = Base64Utils.decode(username);
      }catch (Exception e){
          e.printStackTrace();
      }

        super.setUsername(newUserName);
    }

    @Override
    public void setPassword(String password) {
        String newPassword = null;
        try {
            newPassword = Base64Utils.decode(password);
        }catch (Exception e){
            e.printStackTrace();
        }
        super.setPassword(newPassword);
    }

   /* public static void main(String[] args) {
        //数据库账号密码!
        String userName= "bos";
        String password = "bos";
        try {
            String encode = Base64Utils.encode(userName.getBytes());
            System.out.println(encode);
            System.out.println();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }*/
}
